NS 3 simulation examples:
- NS 3 simulation examples helps researchers and students to have a idea about NS3.NS3 was developed mainly for education and research purpose. It was designed after NS2 . NS3 was created with the help of C++. Bindings done in python.The aim of ns-3 projects is to create open source software for networking. NS3 is a discrete event simulator and also open source software. NS3 software simulates the models realistic which helps to use the ns3 as a real time network emulator.
-
Installation:
-
1.Download NS3 source file from the corresponding website
2.Install python and c++ as the pre-request
3.Ns3 is run with the help of WAF
To build and run a project in the simulator then type the following commands once after you complete your coding
1.$Cd ns-3.18
2.$Cp filepath/filename.cc
3.$./waf --run filename
-
Steps to write a script:
- To simulate our network we need to write the scripts
Running the simulator:
1. Include all the required files
2. Create nodes
3. MAC and PHY net devices are created
4. Interconnect the net devices
5. Protocol stack is installed
6. Routing , tracing and simulation start and end time is setted
7. Run the simulation
We help B.E/M.E students , phd scholars to do their own NS3 simulation examples.Let us see some snippets to write a ns3 code.
How to run a ns3 script?
To run a ns3 script use the following command
./waf --run filename
How to run ns3 in network animator?
1.In addition to the header files we needed include the following header file
#include "ns3/netanim-module.h"
2. To simulate the ns3 in Network animator we need to create a .XML file to create the animation.xml file we need to use the following command
AnimationInterface anim ("filename.xml");
3. To position the nodes in the animator give the location as follows
anim.SetConstantPosition(nodes.Get(0),1.0,2.0);
anim.SetConstantPosition(nodes.Get(1),2.0,3.0);
How to run in Python?
1.Create the python script file
2.Run the program by giving the following command
./waf --run filename --visualize
We support PG/UG scholars to do their projects in NS3 also helps to understand them with ns2 simulation examples.